home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Sample Code / AOCE Sample Code / Catalog Service Access Module / DTS Sample CSAM / Src / CSAM_DSParseProc.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-06-23  |  2.4 KB  |  93 lines  |  [TEXT/KAHL]

  1. /*                                CSAM_DSParseProc.c                                */
  2. /*
  3.  * CSAM_DSParseProc.c
  4.  * Copyright © 1992-93 Apple Computer Inc. All Rights Reserved.
  5.  *
  6.  * The CSAM Manager calls this function to process CSAM parse events. The simple
  7.  * ones are handled immediately, while the complex calls (those that require
  8.  * additional I/O operations) are handled via DirParseCommon().
  9.  *
  10.  * Edit History
  11.  * 8-Jul-1993    MM    DirFindRecordParse skeleton.
  12.  */
  13. #include "DTSSampleCSAM.h"
  14. #ifdef THINK_C
  15. #include <ASM.h>
  16. #endif
  17.  
  18. pascal OSErr
  19. CSAM_DSParseProc(
  20.         register DTSSampleCSAMInfoPtr    infoPtr,
  21.         register DirParamBlockPtr        pb,
  22.         Boolean                            async
  23.     )
  24. {
  25.         short                    refNum;
  26.         long                    saveA5;
  27.         
  28. #ifdef THINK_C
  29.         /*
  30.          * Under Think C, we must save and set up the A4 parameter value.
  31.          * This module must exit at the end of the function.
  32.          */
  33.         asm {
  34.             move.l        a4,-(sp)
  35.             move.l        infoPtr,a0
  36.             move.l        OFFSET(DTSSampleCSAMInfo,originalA4)(a0),a4
  37.         }
  38. #endif                    
  39.         STATUS = ioBusy;
  40.         /*
  41.          * Look at the request code. Handle the simple requests here: these cannot
  42.          * initiate asychronous I/O. The hard ones are queued into the main handler.
  43.          */
  44.         switch (PARAM.header.reqCode) {
  45.         case kDirGetDNodeAccessControlParse:
  46.         case kDirGetAttributeAccessControlParse:
  47.         case kDirGetRecordAccessControlParse:
  48.             if (PARAM.header.reqCode == kDirGetDNodeAccessControlParse) {
  49.                 STATUS = GetRefNumFromRLI(
  50.                             infoPtr,
  51.                             PARAM.getDNodeAccessControlParsePB.pRLI,
  52.                             &refNum
  53.                         );
  54.                 }
  55.             else {
  56.                 STATUS = GetRefNumFromRLI(
  57.                             infoPtr,
  58.                             PARAM.getRecordAccessControlParsePB.aRecord->rli,
  59.                             &refNum
  60.                         );
  61.             }
  62.             if (STATUS == noErr
  63.              && PARAM.getRecordAccessControlParsePB.eachObject != NULL) {
  64.                 saveA5 = SetA5(PARAM.header.saveA5);
  65.                 (PARAM.getRecordAccessControlParsePB.eachObject) (
  66.                     PARAM.header.clientData,
  67.                     OCEGetAccessControlDSSpec(kMeMask),
  68.                     kMyAccessMask,
  69.                     kMyAccessMask,
  70.                     kMyAccessMask
  71.                 );
  72.                 SetA5(saveA5);
  73.             }
  74.             LogStatusX('ADAS', STATUS, "\pADASLookupAttributeValue err");
  75.             CallCompletion((ParmBlkPtr) pb);
  76.             break;
  77.         default:
  78.             /*
  79.              * Call the hard stuff. These calls may initiate further I/O.
  80.              * DirParseCommon returns ioBusy (== one) if it was called
  81.              * asychronously and the request is pending. DirParseCommon
  82.              * will call the user ioCompletion routine, if any.
  83.              */
  84.             DirParseCommon(infoPtr, pb, async);
  85.             break;
  86.         }
  87. #ifdef THINK_C
  88.         asm {
  89.             move.l        (sp)+,a4
  90.         }
  91. #endif
  92.         return (STATUS);
  93. }